package com.wyfan.scaffold.dao.mysql;

import com.wyfan.scaffold.dto.Temp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TempMapper {

    @Insert("<script>" +
            "insert ignore into temp (name,create_date) values " +
            "<foreach collection='temps' item='temp' separator=','>" +
            "   (#{temp.name},#{temp.createDate})" +
            "</foreach></script>")
    @Options(useGeneratedKeys = true, keyProperty = "id",keyColumn = "id")
    int batchInsertTemps(@Param("temps") List<Temp> temps);
}
